<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/3/7 0007
 * Time: 20:56
 */
for ($i = 0; $i < 2; $i++) {
    $pid = pcntl_fork();
    var_dump($i);
    if ($pid < 0) {
        exit('创建失败');
    } elseif ($pid > 0) {
        //父进程空间 返回子进程ID


    } elseif ($pid == 0) { // 返回0子进程空间
        sleep(2);
//        exit();
    }
}
$status = 0;
pcntl_wait($status);